<?php defined('BASEPATH') OR exit('No direct script access allowed.');

/**
  * The Pagination helper cuts out some of the bumf of normal pagination

 **/

function create_pagination($uri, $total_rows, $limit = NULL, $uri_segment = 3)
{
	$CI =& get_instance();
	$current_page = $this->uri->segment($uri_segment, 0);

	// Initialize pagination
	$config['base_url']				= site_url($uri);
	$config['total_rows']			= $total_rows; // count all records
	$config['per_page']				= $limit === NULL ? 50 : $limit;
	$config['uri_segment']			= $uri_segment;
	$config['page_query_string']	= FALSE;

	$config['num_links'] = 3;

	$config['full_tag_open']  = '<ul id="pagination">';
	$config['full_tag_close'] = '</ul>';

	$config['first_link']      = '<< Pertama';
	$config['first_tag_open']  = '<li class="first">';
	$config['first_tag_close'] = '</li>';

	$config['prev_link']       = '< Sebelumnya';
	$config['prev_tag_open']   = '<li class="previous-off">';
	$config['prev_tag_close']  = '</li>';

	$config['cur_tag_open']    = '<li class="active">';
	$config['cur_tag_close']   = '</li>';

	$config['num_tag_open']    = '<li>';
	$config['num_tag_close']   = '</li>';

	$config['next_link']       = 'Selanjutnya >';
	$config['next_tag_open']   = '<li class="next-off">';
	$config['next_tag_close']  = '</li>';

	$config['last_link']       = ' Terakhir >>';
	$config['last_tag_open']   = '<li >';
	$config['last_tag_close']  = '</li>';

	
	$CI->pagination->initialize($config); // initialize pagination
	return array(
		'current_page' 	=> $current_page,
		'per_page' 		=> $config['per_page'],
		'limit'			=> array($config['per_page'], $current_page),
		'links' 		=> $this->pagination->create_links()
	);
}
?>
						
